package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    /**
     * 根据openid查询用户
     * @param openid
     * @return
     */
    @Select("select id, openid, name, phone, sex, id_number, avatar, create_time from user where openid =#{openid}")
    public User getByOpenId(String openid);

    void insert(User user);

    /**
     * 通过用户id查询当前用户
     * @param userId
     * @return
     */
    @Select("select id, openid, name, phone, sex, id_number, avatar, create_time from user where id = #{userId}")
    User getById(Long userId);
}
